// server.js


fetch('/api/login', {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json'
    },
    body: JSON.stringify({
        userName: document.getElementById('userName').value,
        password: document.getElementById('password').value
    })
})
    .then(response => response.json())
    .then(data => {
        if (data === "Login successful") {
            window.location.href = "/index.html";
        } else {
            alert(data);
        }
    });